/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ function(module, exports, __webpack_require__) {

	/**
	 * Created by Administrator on 2017/3/9.
	 */
	var Slider = __webpack_require__(27);

	var Root = React.createClass({displayName: "Root",
	    render:function(){
	        var config = {
	            dots: true,
	            arrows: true,
	            autoPlay: true,
	            autoPlaySpeed: 2000
	        }
	        return(
	            React.createElement("div", {className: "slider-warp"}, 
	                React.createElement(Slider, {config: config}, 
	                    React.createElement("div", {className: "ucs-slider-item active-item", style: {background: "url(../images/1/b0.jpg)  center 0 no-repeat"}}, 
	                        React.createElement("div", {className: "inner"})
	                    ), 
	                    React.createElement("div", {className: "ucs-slider-item", style: {background: "url(../images/1/b1.jpg)  center 0 no-repeat"}}, 
	                        React.createElement("div", {className: "inner"})
	                    ), 
	                    React.createElement("div", {className: "ucs-slider-item", style: {background: "url(../images/1/b3.jpg)  center 0 no-repeat"}}, 
	                        React.createElement("div", {className: "inner"})
	                    )
	                )
	            )
	        )
	    }
	});
	ReactDOM.render(React.createElement(Root, null), document.getElementById('main'));

/***/ },

/***/ 27:
/***/ function(module, exports) {

	/**
	 * Created by Administrator on 2017/3/17.
	 */
	    //查询样式是否存在
	function hasClass(elem, cls) {
	    elem = elem || {};
	    return new RegExp("\\b" + cls + "\\b").test(elem.className);
	};
	//添加样式
	function addClass(elem, cls) {
	    elem = elem || {};
	    hasClass(elem, cls) || (elem.className += " " + cls);
	    elem.className = elem.className.replace(/^\s|\s$/g, "").replace(/\s+/g, " ");
	    return this;
	};
	//删除样式
	function removeClass(elem, cls) {
	    elem = elem || {};
	    if (hasClass(elem, cls)) {
	        elem.className = elem.className.replace(new RegExp("(\\s|^)" + cls + "(\\s|$)"), "");
	    }
	    return this;
	};
	var Slider = React.createClass({displayName: "Slider",
	    getDefaultProps:function(){
	        return{
	            config: {
	                dots: true,
	                arrows: true,
	                autoPlay: true,
	                autoPlaySpeed: 2000
	            }
	        }
	    },
	    componentDidMount: function(){
	        this.count = 0;
	        if(this.props.config.autoPlay&&this.props.children.length>1){
	            this.slideHandler();
	        }
	        if (window.addEventListener) {
	            window.addEventListener('blur', this.onWindowBlur.bind(this));
	            window.addEventListener('focus', this.onWindowFocus.bind(this));
	        } else {
	            window.attachEvent('blur', this.onWindowBlur.bind(this));
	            window.attachEvent('focus', this.onWindowFocus.bind(this));
	        }
	    },
	    slideHandler: function(){
	        var _this = this;
	        var items = _this.refs['ucs-slider-list'].childNodes;
	        var dots;
	        if(_this.props.config.dots){
	            dots = _this.refs['dots'].childNodes;
	        }
	        _this.timer = null;
	        _this.timer = setInterval(function(){
	            for(var i = 0; i < items.length; i ++){
	                removeClass(items[i],"active-item");
	                if(_this.props.config.dots){
	                    removeClass(dots[i],"current");
	                }
	                items[i].style.opacity = 0;
	            }
	            if(_this.count == items.length-1){
	                _this.count = 0;
	            }else{
	                _this.count++;
	            }
	            addClass(items[_this.count],"active-item");
	            if(_this.props.config.dots){
	                addClass(dots[_this.count],"current");
	            }
	            _this.fadeInHandler();
	        },_this.props.config.autoPlaySpeed);
	    },
	    onWindowFocus: function(){
	        if(this.props.config.autoPlay&&this.props.children.length>1){
	            this.slideHandler();
	        }
	    },
	    onWindowBlur: function(){
	        if(this.timer){
	            clearInterval(this.timer);
	            this.timer = null;
	        }
	    },
	    mouseOverHandler: function(){
	        if(this.timer){
	            clearInterval(this.timer);
	            this.timer = null;
	        }
	    },
	    mouseOutHandler: function(){
	        if(this.props.config.autoPlay&&this.props.children.length>1){
	            this.slideHandler();
	        }
	    },
	    dotClickHandler: function(e){
	        var _this = this;

	        var items = _this.refs['ucs-slider-list'].childNodes;
	        var dots = _this.refs['dots'].childNodes;
	        for(var i = 0; i < items.length; i ++){
	            removeClass(items[i],"active-item");
	            removeClass(dots[i],"current");
	        }
	        addClass(items[e.target.parentNode.value],"active-item");
	        addClass(dots[e.target.parentNode.value],"current");
	        _this.count = e.target.parentNode.value;
	        _this.fadeInHandler();
	    },
	    prevHandler: function(){
	        var _this = this;

	        var items = _this.refs['ucs-slider-list'].childNodes;
	        var dots;
	        if(_this.props.config.dots){
	            dots = _this.refs['dots'].childNodes;
	        }
	        for(var i = 0; i < items.length; i ++){
	            removeClass(items[i],"active-item");
	            if(_this.props.config.dots){
	                removeClass(dots[i],"current");
	            }
	        }
	        if(_this.count == 0){
	            _this.count = items.length-1;
	        }else{
	            _this.count--;
	        }
	        addClass(items[_this.count],"active-item");
	        if(_this.props.config.dots){
	            addClass(dots[_this.count],"current");
	        }
	        if(_this.props.config.dots){
	            removeClass(dots[i],"current");
	        }
	        this.fadeInHandler();
	    },
	    nextHandler: function(){
	        var _this = this;

	        var items = _this.refs['ucs-slider-list'].childNodes;
	        var dots;
	        if(_this.props.config.dots){
	            dots = _this.refs['dots'].childNodes;
	        }
	        for(var i = 0; i < items.length; i ++){
	            removeClass(items[i],"active-item");
	            if(_this.props.config.dots){
	                removeClass(dots[i],"current");
	            }
	        }
	        if(_this.count == items.length-1){
	            _this.count = 0;
	        }else{
	            _this.count++;
	        }
	        addClass(items[_this.count],"active-item");
	        if(_this.props.config.dots){
	            addClass(dots[_this.count],"current");
	        }
	        this.fadeInHandler();
	    },
	    fadeInHandler: function(){
	        var _this = this;
	        var items = _this.refs['ucs-slider-list'].childNodes;
	        var opt = 0;
	        var tm = setInterval(function(){
	            if(opt>1){
	                clearInterval(tm);
	            }else{
	                opt += 0.1;
	            }
	            items[_this.count].style.opacity = opt;
	        },50);
	    },
	    render:function(){
	        var _this = this;
	        var childLength = _this.props.children.length;
	        return(
	            React.createElement("div", {className: "ucs-slider", onmouseover: _this.mouseOverHandler.bind(_this), onmouseout: _this.mouseOutHandler.bind(_this)}, 
	                React.createElement("div", {className: "ucs-slider-list", ref: "ucs-slider-list"}, 
	                    _this.props.children
	                ), 
	                
	                    (_this.props.config.dots&&childLength>1)?(
	                        React.createElement("div", {className: "dots"}, 
	                            React.createElement("ul", {ref: "dots"}, 
	                                
	                                    _this.props.children.map(function(item,index){
	                                        if(index == 0){
	                                            return (React.createElement("li", {value: index, className: "current"}, React.createElement("a", {href: "javascript:void(0)", onclick: _this.dotClickHandler.bind(_this)})));
	                                        }else{
	                                            return (React.createElement("li", {value: index}, React.createElement("a", {href: "javascript:void(0)", onclick: _this.dotClickHandler.bind(_this)})));
	                                        }
	                                    })
	                                
	                            )
	                        )
	                    ):"", 
	                
	                
	                    (_this.props.config.arrows&&childLength>1)?(
	                        React.createElement("div", {className: "arrows"}, 
	                            React.createElement("a", {href: "javascript:void(0)", className: "prev", onclick: _this.prevHandler.bind(_this)}), 
	                            React.createElement("a", {href: "javascript:void(0)", className: "next", onclick: _this.nextHandler.bind(_this)})
	                        )
	                    ):""
	                
	            )
	        )
	    }
	});

	module.exports = Slider;

/***/ }

/******/ });